<template>
  <div style="width: 100%">
    <template>
      <div v-if="mode === 'edit'">
        <div
          :style="{
            color: strColor,
            fontSize: strSize + 'px',
            textAlign: strAlign,
          }"
          :class="strWeight ? 'weight' : ''"
        >
          {{ content }}
        </div>
        <!-- <p>{{ content }}</p> -->
      </div>
      <div v-else>
        {{ value }}
      </div>
    </template>
  </div>
</template>
<script>
export default {
  name: "pm-titles",
  props: {
    value: {
      type: String | Number | Object | Array,
    },
    mode: {
      // 编辑态: edit, 查看态:view , 用于在子表格内切换状态
      default: "edit",
    },
    entityModel: {
      // 如果组件绑定了一个实体, 则该属性会传入实体的数据
      default: () => {},
    },
    readonly: {
      default: false,
    },
    disabled: {
      default: false,
    },
    content: {
      default: "标题名称",
    },
    strColor: {
      default: "",
    },
    strSize: {
      default: "",
    },
    strWeight: {
      default: false,
    },
    strAlign: {
      default: "",
    },
  },
  computed: {},
  methods: {},
  mounted() {
    console.log(this.value, "value");
    if (this.value) {
      this.content = this.value;
      if (this.mode == "view") {
        this.disabled = true;
      }
    }
  },
};
</script>
<style scoped>
.weight {
  font-weight: bold;
}
.time {
  font-size: 13px;
  color: #999;
}

.bottom {
  margin-top: 13px;
  line-height: 12px;
}

.button {
  padding: 0;
  float: right;
}

.image {
  width: 100%;
  display: block;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both;
}
</style>
